name: CodeQL

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    - cron: '30 06 * * 6'

env:
  GO_VERSION: 1.22.2

jobs:
  analyze:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v4
      - name: Set up Go 1.x
        uses: actions/setup-go@v5
        with:
          go-version: ${{ env.GO_VERSION }}
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: go
          build-mode: manual
      - name: Build
        run: make proto-deps yacc-deps deps build
      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3
        with:
          category: "/language:go"
